package com.sdsy.interceptor;

import com.sdsy.domain.EthLoginDO;
import com.sdsy.util.CommTypeUtils;
import com.sdsy.util.SysUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Configuration
public class LoginInterceptor extends WebMvcConfigurerAdapter {


    @Bean
    public AuthInterceptor authInterceptor() {
        return new AuthInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration addInterceptor = registry.addInterceptor(authInterceptor());
        addInterceptor.excludePathPatterns("/login");
        addInterceptor.excludePathPatterns("/ethLogin/login");
        addInterceptor.addPathPatterns("/**");
    }

}
